package com.leimo.controller;

import com.leimo.dto.ChatInfoDto;
import com.leimo.service.TouristService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

/**
 * 游客
 *
 * @author 段誉
 * @create 2019-02-26 17:08
 */
@Controller
@RequestMapping("/tourist")
public class TouristController {
  @Autowired
  private TouristService touristService;

  @GetMapping
  public String index(Model model, HttpServletRequest request) {
    String sessionId = request.getSession().getId();
    model.addAttribute("sessionId", sessionId);
    return "/im/tourist";
  }

  /**
   * 获取游客信息
   * @return
   */
  @GetMapping("/get_info")
  @ResponseBody
  public ChatInfoDto getInfo() {
    return touristService.getInfo();
  }
}
